package com.hd.springbootstudy.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @Author: Lemon
 * @Date: 2021/4/20 22:23
 */

/**
 * Swagger3接口文档配置注解
 */
@EnableOpenApi
/**
 * 将该配置类交给spring ioc容器
 */
@Configuration
public class SwaggerConfig {
    /**
     * 将该配置类交给spring ioc容器
     */
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.OAS_30) // v2 不同
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.hd.springbootstudy.controller")) // 设置扫描路径
                .build();
    }
}
